import React from 'react';
import BaseScreen from "../BaseScreen";
import styles from "../../css/AboutUs.module.css"
import { myNav } from "../../const/imgs"
import { aboutUs } from '../../service/MineService'
import { basename } from 'path';
import { getTOKEN } from '../../utils/StorageUtil';
import ProgressView from "../../view/ProgressView";

class AboutUs extends BaseScreen {
  constructor(props) {
    super(props)
    this.state = {
      loading: false
    }
  }
  componentDidMount() {
    this.setState({ loading: true })
    
    aboutUs({
      token: getTOKEN()
    })
      .then(
        res => {
    this.setState({ loading: false })          
          if (res.error_code === 0) {
            const data = res.data
            this.setState({
              version: data.version,
            })
            var div = document.createElement("div");
            div.innerHTML = data.content
            this.refs.content.appendChild(div)
          }
        }
      )
      .catch(
        err => {
          console.log(err)
        }
      )
  }
  render() {
    const { version, content,loading } = this.state
    return (
      <div>
        <Header version={version} />
        <div className={styles.us_des} ref='content'>
        </div>
        {/* <Footer /> */}
        <ProgressView visibility={loading} mode={ProgressView.MODE_MEDIUM} />
        
      </div>
    )
  }
}
const Header = ({ version }) => {
  return (
    <div className={styles.us_header}>
      <div className={styles.us_logo}>
        <img src={myNav.AVATAR} />
      </div>
      <div className={styles.us_name}>
        信管云
        </div>
      <div className={styles.us_version}>
        当前版本 {version}
      </div>
    </div>

  )
}

const Descriptions = ({ content }) => {
  return (
    <div className={styles.us_des}>
      {/* {content} */}
    </div>
  )
}
class Footer extends React.Component {
  render() {
    return (
      <div className={styles.us_footer}>
        <div className={styles.us_corp}>
          上海晟盾金融信息服务有限公司
      </div>
        <div className={styles.us_corp}>
          2017 Shanghai Shengdun Financial Information Service Co.,Ltd
      </div>
      </div>
    )
  }
}

const parseToDOM = (str) => {
  var div = document.createElement("div");
  if (typeof str == "string")
    div.innerHTML = str;

  return div.childNodes;
}
export default AboutUs;